//
//  HMDocDetailModel.m
//  仿真开发
//
//  Created by LZH on 2017/3/23.
//  Copyright © 2017年 B.HOPE. All rights reserved.

#import "HMDocDetailModel.h"
#import "HMTool.h"
#import <YYModel.h>

@implementation HMDocDetailModel


+(void)getDocDetailDataWithURLString:(NSString *)URLString andParameters:(NSDictionary *)parameters andSuccessBlock:(void (^)(NSArray *newList))successBlock andErrorBlock:(void (^)(NSError *error))errorBlock{
    
    [[HMTool sharedNetworkTool]POSTWithURLString:URLString parameters:parameters success:^(id responseObject) {
        
       
        NSDictionary*jsons=[NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
       
        //通过key取出字典数组
        NSDictionary*dict=jsons[@"data"];
        
//        HMDocDetailModel*model=[HMDocDetailModel new];
        
        //遍历字典
//        [dict enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
//            [model setValue:dict[key] forKey:key];
//        }];
//           NSArray*newList=[NSArray arrayWithObject:model];
        
        NSArray *newsList = [NSArray yy_modelArrayWithClass:[HMDocDetailModel class] json:dict];
        
        
     
        
        if (successBlock) {
            successBlock(newsList);
        }
        
        
    } faile:^(NSError *error) {
        if (errorBlock) {
            errorBlock(error);
        }
    }];
    
    
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

@end















